简体   繁体   中英

Installing cocos2d-x on windows 10 without setting python path to an older version

To install cocos2d-x, I ran

 C:\Python27amd64\python.exe setup.py

I use the python 2.7 executable. However I get this error:

Traceback (most recent call last):
  File "setup.py", line 738, in <module>
    import ctypes
  File "C:\Python27amd64\lib\ctypes\__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: Module use of python36.dll conflicts with this version of Python.

And the problem is that I have already set the PYTHONPATH variable to Python 3.6.5, and I can't change it because another program needs to have it set to 3.6.5. How can I install cocos2d-x then?

You can use Anaconda to manage different Python environments in the same machine.

First, uninstall all versions of Python already existing in your system.

Then, install Anaconda from https://www.anaconda.com/ choose the Python 3.6 version.

This will install version 3.6 as your default Python version.

Open the Anaconda command prompt and run the following:

conda create --name py27 python=2.7

This will download python 2.7 to your Anaconda envs folder.

Once installed, whenever you need to use python 2.7 to run your cocos scripts, open the Anaconda prompt and run the following:

activate py27

Everything your run within this command prompt will be executed using python 2.7.

Here is more info about how to manage environments: https://conda.io/docs/user-guide/tasks/manage-environments.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM