Tag Archives: python2.7

Error in python2.7 installation of pycrypto Library [How to Solve]

windows + python2.7

Pre-installed VC packet

https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi

Then execute the command

pip install pycrypto

linux + python2.7

Error in Python installation pycrypto

error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

Check that GCC has been installed. Finally, find a solution and install the python dev library

sudo apt-get install python-dev

After crypto is installed normally

~$ sudo apt-get install python-dev
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
 

The following packages have unmet dependencies:
 python-dev : Depends: libpython-dev (= 2.7.11-1) but it is not going to be installed
              Depends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

 

You can do it with aptitude tool
First:

sudo apt-get install aptitude

Then:

sudo aptitude install python-dev

After that:

sudo aptitude install python-dev
The following NEW packages will be installed:
  libexpat1-dev{ab} libpython-dev{a} libpython2.7-dev{ab} python-dev
  python2.7-dev{ab}
0 packages upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 28.1 MB of archives. After unpacking 42.1 MB will be used.
The following packages have unmet dependencies:
 python2.7-dev : Depends: python2.7 (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.
                 Depends: libpython2.7 (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.
 libexpat1-dev : Depends: libexpat1 (= 2.1.0-7) but 2.1.0-7ubuntu0.16.04.2 is installed.
 libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.
                    Depends: libpython2.7 (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.
open: 24; closed: 106; defer: 16; conflict: 21                                 .The following actions will resolve these dependencies:
 

     Keep the following packages at their current version:

1)     libexpat1-dev [Not Installed]                     
2)     libpython-dev [Not Installed]                     
3)     libpython2.7-dev [Not Installed]                  
4)     python-dev [Not Installed]                        
5)     python2.7-dev [Not Installed]                      

 

Accept this solution?[Y/n/q/?] n Here it must be n, because the solution given is to keep the present state, i.e. not to install
The following actions will resolve these dependencies:

 

     Downgrade the following packages:                                         

1)     libexpat1 [2.1.0-7ubuntu0.16.04.2 (now) -> 2.1.0-7 (xenial)]            
2)     libpython2.7 [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)]       
3)     libpython2.7-minimal [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)]
4)     libpython2.7-stdlib [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)]
5)     python2.7 [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)]          
6)     python2.7-minimal [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)]  
 

 

Accept this solution?[Y/n/q/?] y     Accept the new status and you are ready to install

 

Python2.7 Install Numpy Error:is not a supported wheel on…

The error message of installing numpy in python2.7 is as follows:

C:\Python27\Scripts>pipinstall"numpy-1.9.2+mkl-cp26-none-win_amd64.whl"
numpy-1.9.2+mkl-cp26-none-win_amd64.whlisnotasupportedwheelonthisplatfor
m.

Error reason:

In fact, my Python version is 2.7 and my numpy version is 2.6, so it’s wrong

Solution:

See: file name.wheel is not supported wheel on this platform

Download the numpy installation file of the corresponding version of Python:

Download the file version cp27

Re install run:

C:\Python27\Scripts>pipinstall"numpy-1.9.2+mkl-cp26-none-win_amd64.whl"
numpy-1.9.2+mkl-cp26-none-win_amd64.whlisnotasupportedwheelonthisplatfor
m.

C:\Python27\Scripts>pipinstallC:\python-tools\numpy-1.9.2+mkl-cp27-none-win_am
d64.whl
Processingc:\python-tools\numpy-1.9.2+mkl-cp27-none-win_amd64.whl
Installingcollectedpackages:numpy
Foundexistinginstallation:numpy1.9.2
Uninstallingnumpy-1.9.2:
Successfullyuninstallednumpy-1.9.2
Successfullyinstallednumpy-1.9.2

C:\Python27\Scripts>

Successfully installed

Verify the installation success in shell:

>>>fromnumpyimport*
>>>